import instance from "@/request/request";
import type { Res } from '@/request/ResultApi';

//获取所有流水线
export const getAllAssemblyLine = (size: number, current: number, lineName: String, orderItemId: number): Res<null> =>{
    let str=""
    if(lineName!='')str+='&lineName='+lineName
    if(orderItemId!=-1&&!Number.isNaN(orderItemId))str+='&orderItemId='+orderItemId
return instance.get(`/assemblyline/all?size=${size}&current=${current}${str}`);
}
    

//添加流水线
export const addAssemblyLine = (data: {
    name: String,
    orderItemId: number,
    description: String
}): Res<null> => instance.post("/assemblyline/add", data);

//修改流水线
export const updateAssemblyLine = (data: {
    lineId: number,
    name: String,
    orderItemId: number,
    description: String
}): Res<null> => instance.post("/assemblyline/update", data);

//删除流水线
export const removeAssemblyLine = (assemblyLineId: number): Res<null> =>
    instance.post(`/assemblyline/delete?assemblyLineId=${assemblyLineId}`);

//批量删除流水线
export const removeAssemblyLines = (data: []): Res<null> => instance.post("/assemblyline/deletes", data);